import NodeRSA from 'node-rsa';

// 公钥加密方法 - str
export const  jm  = (str) => {
    const publicKey = localStorage.getItem('public_key');
    const pubKey = new NodeRSA(publicKey,'pkcs8-public');
    return pubKey.encrypt(str, 'base64','utf-8').toString();   
}
// 公钥加密方法 - obj

export const  jmobj  = (obj) => {
    const res = {}
    for(let i in obj){
        res[i] = jm(obj[i]);
    }
    return res;
   
}

